package com.lzp.systemopt.main

import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.base.BaseFragment
import com.lzp.systemopt.DymIconActivity
import com.lzp.systemopt.ImageUtilsActivity
import com.lzp.systemopt.R
import com.lzp.systemopt.camera.activity.CameraActivity
import com.lzp.systemopt.camerax.CameraXActivity
import com.lzp.systemopt.databinding.SystemoptFragmentBinding
import com.lzp.systemopt.messenger.MessengerActivity
import com.lzp.systemopt.nfc.NFCActivity

/**
 * @describe:
 * @Author: lixiaopeng
 * @Date: 2020/3/24
 */
class SystemOptFragment : BaseFragment(), View.OnClickListener {

    private val TAG = "SystemOptFragment"
    private val binding by lazy { SystemoptFragmentBinding.inflate(layoutInflater) }

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        return binding.root
    }

    override fun initView() {
        super.initView()
    }

    override fun setListener() {
        super.setListener()
        binding.cameraTv.setOnClickListener(this)
        binding.cropImageView.setOnClickListener(this)
        binding.nfc.setOnClickListener(this)
        binding.messengerTv.setOnClickListener(this)
        binding.cameraX.setOnClickListener {
            startActivity(Intent(activity, CameraXActivity::class.java))
        }
        binding.dymIcon.setOnClickListener {
            startActivity(Intent(activity, DymIconActivity::class.java))
        }
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.cropImageView -> {
                startActivity(Intent(activity, ImageUtilsActivity::class.java))
            }
            R.id.nfc -> {
                startActivity(Intent(activity, NFCActivity::class.java))
            }
            R.id.cameraTv -> {
                startActivity(Intent(activity, CameraActivity::class.java))
            }
            R.id.messengerTv -> {
                startActivity(Intent(activity, MessengerActivity::class.java))
            }
        }
    }

}